import { ProTable } from '@ant-design/pro-components';
import '@umijs/max';
import { Modal } from 'antd';
import React, { useEffect, useRef } from 'react';
const UpdateModal = (props) => {
    const { values, visible, columns, onCancel, onSubmit } = props;
    const formRef = useRef();
    useEffect(() => {
        let temp;
        if (values.resultProp) {
            temp = {
                ...values,
                resultProp: JSON.parse(values.resultProp),
            };
        }
        if (values.choices) {
            console.log(values.choices);
            temp = {
                ...values,
                choices: JSON.parse(values.choices),
            };
        }
        if (formRef) {
            formRef.current?.setFieldsValue(temp);
        }
    }, [values]);
    return (<Modal open={visible} footer={null} onCancel={() => onCancel?.()}>
      <ProTable type="form" formRef={formRef} columns={columns} onSubmit={async (value) => {
            onSubmit?.(value);
        }}/>
    </Modal>);
};
export default UpdateModal;
//# sourceMappingURL=UpdateModal.jsx.map